﻿using System;
using System.ComponentModel;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using LiveCharts.Definitions.Points;
using LiveCharts.Wpf;
using LiveCharts.Wpf.Points;

namespace LiveCharts.Wpf
{
	public class GVerticalLineSeries : VerticalLineSeries
	{
		public GVerticalLineSeries()
		{
			
		}

		public GVerticalLineSeries(object configuration) : base(configuration)
		{
			
		}

		public override IChartPointView GetPointView(ChartPoint point, string label)
		{
			return this.method_0(point.View, point, label);
		}

		private IChartPointView method_0(IChartPointView ichartPointView_0, ChartPoint chartPoint_0, string string_0)
		{
			VerticalBezierPointView verticalBezierPointView = (VerticalBezierPointView)ichartPointView_0;
			if (verticalBezierPointView == null)
			{
				verticalBezierPointView = new VerticalBezierPointView
				{
					Segment = new BezierSegment(),
					Container = base.Figure,
					IsNew = true
				};
			}
			else
			{
				verticalBezierPointView.IsNew = false;
				chartPoint_0.SeriesView.Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(verticalBezierPointView.Shape);
				chartPoint_0.SeriesView.Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(verticalBezierPointView.DataLabel);
			}
			if (base.PointGeometry != null && Math.Abs(base.PointGeometrySize) > 0.1 && verticalBezierPointView.Shape == null)
			{
				if (base.PointGeometry != null)
				{
					verticalBezierPointView.Shape = new Path
					{
						Stretch = Stretch.Fill,
						ClipToBounds = true,
						StrokeThickness = base.StrokeThickness
					};
				}
				base.Model.Chart.View.AddToDrawMargin(verticalBezierPointView.Shape);
			}
			if (verticalBezierPointView.Shape != null)
			{
				verticalBezierPointView.Shape.Fill = base.PointForeground;
				verticalBezierPointView.Shape.Stroke = base.Stroke;
				verticalBezierPointView.Shape.StrokeThickness = base.StrokeThickness;
				verticalBezierPointView.Shape.Width = base.PointGeometrySize;
				verticalBezierPointView.Shape.Height = base.PointGeometrySize;
				verticalBezierPointView.Shape.Data = base.PointGeometry;
				verticalBezierPointView.Shape.Visibility = base.Visibility;
				Panel.SetZIndex(verticalBezierPointView.Shape, Panel.GetZIndex(this) + 1);
				if (chartPoint_0.Stroke != null)
				{
					verticalBezierPointView.Shape.Stroke = (Brush)chartPoint_0.Stroke;
				}
				if (chartPoint_0.Fill != null)
				{
					verticalBezierPointView.Shape.Fill = (Brush)chartPoint_0.Fill;
				}
			}
			if (base.DataLabels && verticalBezierPointView.DataLabel == null)
			{
				verticalBezierPointView.DataLabel = (verticalBezierPointView.DataLabel = base.UpdateLabelContent(new DataLabelViewModel
				{
					FormattedText = string_0,
					Point = chartPoint_0
				}, verticalBezierPointView.DataLabel));
			}
			if (!base.DataLabels && verticalBezierPointView.DataLabel != null)
			{
				base.Model.Chart.View.RemoveFromDrawMargin(verticalBezierPointView.DataLabel);
				verticalBezierPointView.DataLabel = null;
			}
			return verticalBezierPointView;
		}
	}
}
